import request from '@/config/axios'

// 新闻内容 API
export const ContentNewsApi = {
  // 查询新闻内容分页
  getContentNewsPage: async (params: any) => {
    return await request.get({ url: `/cms/content-news/page`, params })
  },
  getContentNews: async (id: number) => {
    return await request.get({ url: `/cms/content-news/get?id=${id}` })
  },

  getByMenuId: async (menuId: number) => {
    return await request.get({ url: `/cms/content-news/getByMenuId?menuId=${menuId}` })
  },

  // 新增新闻内容
  createContentNews: async (data: any) => {
    return await request.post({ url: `/cms/content-news/create`, data })
  },

  // 修改新闻内容
  updateContentNews: async (data: any) => {
    return await request.put({ url: `/cms/content-news/update`, data })
  },

  // 删除新闻内容
  deleteContentNews: async (id: number) => {
    return await request.delete({ url: `/cms/content-news/delete?id=` + id })
  },

  // 导出新闻内容 Excel
  exportContentNews: async (params) => {
    return await request.download({ url: `/cms/content-news/export-excel`, params })
  },
}
